package edu.guet.simplefactory;

/**
 * 使用单独的一个类去考虑实例话情况。例如扩展性、根据情况去创建对象。
 */
public class OperationFactory {

    public static Operation createOperation(String operate){

        Operation operation =null;

        switch (operate){
            case "+":
                operation = new OperationAdd();
                break;
            case "-":
                operation = new OperationSub();
                break;
            case "*":
                operation = new OperationMul();
                break;
            case "/":
                operation = new OperationDiv();
                break;
        }
        return operation;
    }
}
